let mongoose = require('mongoose')
let defaultImg = require('../img/index.js')

const userSchema = new mongoose.Schema({
	username:{
		type: String
	},
	password:{
		type: String
	},
	//0:男 1:女
	sex: Number,
	isManager: {
		type: Boolean,
		default: false
	},
	//头像
	avatar: {
		type: String,
		default: defaultImg
	},
	//物品id数组
	gainObjs: {
		type: Array,
		default: []
	}
	
})

let User = mongoose.model('User',userSchema)

 // User.create({
 // 	username: "lin",
 // 	password: "123456",
 // 	sex: 0,
 // 	isManeger: true,
 // }).then(value=> console.log(value))
 // User.findOne({username:"lin"}).then(value => console.log(value))
module.exports = User
